<?php
$domain = $argv[1];
$order_id = $argv[2];
$host_id = $argv[3];

if (empty($domain)  ) {

	die('No Params');
}

set_time_limit(0);

require_once(dirname(__FILE__) . '/../../lib/init.php');

cachemgr::init(false);

$db = kernel::database();
$sql = "select s.order_id,s.obj_id,o.order_bn from sdb_ome_order_objects as s left join sdb_ome_orders as o on s.order_id=o.order_id where s.obj_type='goods' and s.pmt_price>0";
$order_list = $db->select($sql);
foreach($order_list as $orders){
    $order_id = $orders['order_id'];
    $obj_id = $orders['obj_id'];
    $updatesql = "update sdb_ome_order_items SET sale_price-pmt_price WHERE order_id=".$order_id." AND obj_id=".$obj_id;
    $db->exec($updatesql);
}

